package com.tx.server.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import com.kenmal.redis.JedisUtil;
import com.kenmal.redis.JedisUtil.Key;

@Configuration
public class KenmalRedisConfig {

	@Autowired
	private Environment env;

	@Bean
	public JedisUtil getJedisUtil() {
		return new JedisUtil(env.getProperty("redis.ip").toString(),
				Integer.parseInt(env.getProperty("redis.port").toString()), env
						.getProperty("redis.pwd").toString());
	}

	@Bean
	public Key getJedisKey() {
		return getJedisUtil().getKey();
	}
}
